import '../api/api_services.dart';
import '../api/post_api.dart';
import '../model/api_response.dart';
import '../model/post.dart';

class PostRepository{


  Future<ApiResponse<Object>> addPost(Post post) async{
    try{
      return await ApiService.createPost(post);
    }catch(e){
      return ApiResponse(data: null, status: 500, message: "Failed to create user: $e");
    }
  }

  // 获取post
  Future<ApiResponse<List<Post>>> getPosts() async {
    // return await JsonPlaceholderApi.getPosts();
    return await PostApi.getPosts();
  }


}